library(readr)
data <- read_csv("data/new_data/data_bystate_temp_perc.csv")
Rows: 1334 Columns: 21── Column specification ─────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): months, state
dbl (19): year, colony_n, colony_max, colony_lost, colony_lost_pct, colony_added, colony_reno...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
data <- data %>% mutate(colony_lost_pct = colony_lost_pct/100)
data <- data %>% mutate(Varroa.mites = Varroa.mites/100)
data <- data %>% mutate(Other.pests.parasites = Other.pests.parasites/100)
data <- data %>% mutate(Disesases = Disesases/100)
data <- data %>% mutate(Pesticides = Pesticides/100)
data <- data %>% mutate(Other = Other/100)
data <- data %>% mutate(Unknown = Unknown/100)
lin_mod_n <- lm(data=data, colony_lost ~ colony_max + state + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown+year)
summary(lin_mod_n)
Call:
lm(formula = colony_lost ~ colony_max + state + months + Varroa.mites +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown + year, data = data)
Residuals:
Min 1Q Median 3Q Max
-91795 -1468 -236 1542 67858
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.429e+05 1.631e+05 2.715 0.00671 **
colony_max 1.613e-01 3.082e-03 52.326 < 2e-16 ***
statearizona 1.897e+02 1.726e+03 0.110 0.91250
statearkansas -1.105e+03 1.719e+03 -0.643 0.52028
statecalifornia -5.189e+04 3.977e+03 -13.046 < 2e-16 ***
statecolorado -2.762e+02 1.750e+03 -0.158 0.87456
stateconnecticut 2.131e+02 1.737e+03 0.123 0.90241
stateflorida -8.585e+03 1.881e+03 -4.565 5.48e-06 ***
stategeorgia -3.632e+03 1.750e+03 -2.076 0.03813 *
statehawaii 9.786e+00 1.814e+03 0.005 0.99570
stateidaho -8.695e+03 1.788e+03 -4.863 1.30e-06 ***
stateillinois -2.443e+02 1.707e+03 -0.143 0.88621
stateindiana -6.220e+02 1.726e+03 -0.360 0.71861
stateiowa -2.294e+03 1.729e+03 -1.327 0.18477
statekansas -8.837e+02 1.721e+03 -0.514 0.60767
statekentucky -2.974e+02 1.688e+03 -0.176 0.86022
statelouisiana -3.582e+03 1.707e+03 -2.098 0.03607 *
statemaine -4.732e+02 1.735e+03 -0.273 0.78513
statemaryland 6.694e+01 1.724e+03 0.039 0.96904
statemassachusetts -3.317e+02 1.722e+03 -0.193 0.84734
statemichigan -5.004e+03 1.741e+03 -2.874 0.00413 **
stateminnesota -5.754e+03 1.767e+03 -3.256 0.00116 **
statemississippi -2.389e+03 1.694e+03 -1.410 0.15872
statemissouri -1.393e+02 1.700e+03 -0.082 0.93473
statemontana -1.053e+04 1.761e+03 -5.979 2.92e-09 ***
statenebraska -2.388e+03 1.741e+03 -1.372 0.17044
statenew jersey -1.159e+03 1.735e+03 -0.668 0.50429
statenew mexico 5.369e+02 1.794e+03 0.299 0.76478
statenew york -2.291e+03 1.720e+03 -1.332 0.18298
statenorth carolina -7.721e+02 1.710e+03 -0.452 0.65160
statenorth dakota -2.866e+04 2.051e+03 -13.972 < 2e-16 ***
stateohio -5.605e+02 1.703e+03 -0.329 0.74215
stateoklahoma -1.492e+03 1.722e+03 -0.867 0.38614
stateoregon -9.088e+03 1.768e+03 -5.142 3.15e-07 ***
stateother states -3.600e+01 1.738e+03 -0.021 0.98348
statepennsylvania -7.084e+02 1.722e+03 -0.411 0.68083
statesouth carolina -6.225e+02 1.704e+03 -0.365 0.71500
statesouth dakota -9.922e+03 1.796e+03 -5.526 3.96e-08 ***
statetennessee 1.793e+02 1.686e+03 0.106 0.91531
statetexas -1.696e+04 1.897e+03 -8.943 < 2e-16 ***
stateutah -1.383e+03 1.739e+03 -0.795 0.42665
statevermont -2.461e+02 1.737e+03 -0.142 0.88736
statevirginia 2.207e+01 1.693e+03 0.013 0.98960
statewashington -7.111e+03 1.766e+03 -4.027 5.99e-05 ***
statewest virginia 5.712e+01 1.719e+03 0.033 0.97349
statewisconsin -3.376e+03 1.734e+03 -1.947 0.05173 .
statewyoming -1.104e+03 1.741e+03 -0.634 0.52627
monthsQ2 -3.837e+03 5.025e+02 -7.635 4.40e-14 ***
monthsQ3 -7.368e+02 5.321e+02 -1.385 0.16645
monthsQ4 -1.666e+03 5.087e+02 -3.274 0.00109 **
Varroa.mites 1.046e+03 1.326e+03 0.789 0.43052
Other.pests.parasites -2.673e+03 2.045e+03 -1.307 0.19136
Disesases -1.091e+03 3.201e+03 -0.341 0.73331
Pesticides 6.317e+03 2.546e+03 2.481 0.01323 *
Other 5.387e+03 3.218e+03 1.674 0.09433 .
Unknown 8.291e+03 3.989e+03 2.078 0.03788 *
year -2.192e+02 8.081e+01 -2.713 0.00676 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6398 on 1277 degrees of freedom
Multiple R-squared: 0.9296, Adjusted R-squared: 0.9265
F-statistic: 301 on 56 and 1277 DF, p-value: < 2.2e-16
lin_mod <- lm(data=data, colony_lost_pct ~ state + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown)
summary(lin_mod)
Call:
lm(formula = colony_lost_pct ~ state + months + Varroa.mites +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown, data = data)
Residuals:
Min 1Q Median 3Q Max
-0.15729 -0.03549 -0.00630 0.02579 0.52253
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.134863 0.012040 11.201 < 2e-16 ***
statearizona 0.015616 0.015795 0.989 0.323023
statearkansas -0.014692 0.015738 -0.934 0.350698
statecalifornia -0.052587 0.015864 -3.315 0.000943 ***
statecolorado -0.013548 0.016018 -0.846 0.397823
stateconnecticut -0.062775 0.015911 -3.945 8.40e-05 ***
stateflorida -0.032538 0.015585 -2.088 0.037018 *
stategeorgia -0.027561 0.015677 -1.758 0.078988 .
statehawaii -0.073561 0.016600 -4.431 1.02e-05 ***
stateidaho -0.055737 0.016010 -3.481 0.000516 ***
stateillinois -0.004453 0.015628 -0.285 0.775714
stateindiana -0.014200 0.015805 -0.898 0.369130
stateiowa -0.046773 0.015817 -2.957 0.003162 **
statekansas 0.018607 0.015755 1.181 0.237832
statekentucky -0.015248 0.015462 -0.986 0.324255
statelouisiana -0.056640 0.015586 -3.634 0.000290 ***
statemaine -0.042641 0.015890 -2.683 0.007380 **
statemaryland -0.009554 0.015792 -0.605 0.545282
statemassachusetts -0.018497 0.015775 -1.173 0.241197
statemichigan -0.042525 0.015807 -2.690 0.007231 **
stateminnesota -0.042932 0.015956 -2.691 0.007226 **
statemississippi -0.039995 0.015486 -2.583 0.009916 **
statemissouri -0.024174 0.015572 -1.552 0.120818
statemontana -0.085721 0.015855 -5.407 7.66e-08 ***
statenebraska -0.040909 0.015914 -2.571 0.010261 *
statenew jersey -0.075657 0.015888 -4.762 2.13e-06 ***
statenew mexico 0.028963 0.016430 1.763 0.078172 .
statenew york -0.036030 0.015708 -2.294 0.021966 *
statenorth carolina -0.024098 0.015652 -1.540 0.123911
statenorth dakota -0.070309 0.015853 -4.435 1.00e-05 ***
stateohio -0.017524 0.015596 -1.124 0.261389
stateoklahoma -0.039908 0.015759 -2.532 0.011448 *
stateoregon -0.077638 0.015956 -4.866 1.28e-06 ***
stateother states -0.023476 0.015918 -1.475 0.140495
statepennsylvania -0.020514 0.015764 -1.301 0.193368
statesouth carolina -0.032838 0.015607 -2.104 0.035568 *
statesouth dakota -0.071388 0.015898 -4.490 7.75e-06 ***
statetennessee 0.008326 0.015440 0.539 0.589792
statetexas -0.044291 0.015597 -2.840 0.004588 **
stateutah -0.031895 0.015919 -2.004 0.045326 *
statevermont -0.075638 0.015912 -4.754 2.22e-06 ***
statevirginia -0.017684 0.015503 -1.141 0.254234
statewashington -0.052592 0.015967 -3.294 0.001015 **
statewest virginia -0.023356 0.015739 -1.484 0.138071
statewisconsin -0.045103 0.015824 -2.850 0.004437 **
statewyoming -0.038614 0.015935 -2.423 0.015521 *
monthsQ2 -0.060056 0.004596 -13.066 < 2e-16 ***
monthsQ3 -0.038871 0.004859 -8.000 2.76e-15 ***
monthsQ4 -0.027263 0.004640 -5.876 5.37e-09 ***
Varroa.mites 0.076841 0.012092 6.355 2.90e-10 ***
Other.pests.parasites -0.050901 0.018723 -2.719 0.006644 **
Disesases 0.026032 0.029249 0.890 0.373626
Pesticides 0.009709 0.023218 0.418 0.675903
Other 0.264096 0.029433 8.973 < 2e-16 ***
Unknown 0.179917 0.036496 4.930 9.31e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.05859 on 1279 degrees of freedom
Multiple R-squared: 0.3859, Adjusted R-squared: 0.36
F-statistic: 14.88 on 54 and 1279 DF, p-value: < 2.2e-16
library(car)
Loading required package: carData
Attaching package: ‘car’
The following object is masked from ‘package:dplyr’:
recode
b <- coefficients(lin_mod)
e <- residuals(lin_mod)
cat("Verify the hypothesis:\n")
Verify the hypothesis:
par(mfrow=c(2,2))
plot(lin_mod)
par(mfrow=c(1,1))
cat("Verify normality of residuals:\n")
Verify normality of residuals:
shapiro.test(residuals(lin_mod))
Shapiro-Wilk normality test
data: residuals(lin_mod)
W = 0.92142, p-value < 2.2e-16
shapiro.test(rstudent(lin_mod))
Shapiro-Wilk normality test
data: rstudent(lin_mod)
W = 0.91839, p-value < 2.2e-16
cat("VIF:\n")
VIF:
vif(lin_mod)
GVIF Df GVIF^(1/(2*Df))
state 3.833007 45 1.015041
months 1.223296 3 1.034162
Varroa.mites 2.070817 1 1.439033
Other.pests.parasites 2.466830 1 1.570615
Disesases 1.399190 1 1.182874
Pesticides 1.684843 1 1.298015
Other 1.381107 1 1.175205
Unknown 1.301936 1 1.141024
Le ipotesi del modello lineare non sono verificate.
Non so se logit va bene visto che abbiamo valori nell’intervallo 0-1 e non 0,1.
data = data %>% mutate(logit_colony_lost_pct=logit(colony_lost_pct))
Warning: proportions remapped to (0.025, 0.975)
logit_mod <- lm(data=data, logit_colony_lost_pct ~ state + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown)
summary(logit_mod)
Call:
lm(formula = logit_colony_lost_pct ~ state + months + Varroa.mites +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown, data = data)
Residuals:
Min 1Q Median 3Q Max
-1.50339 -0.28129 -0.00443 0.28040 2.52331
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.863163 0.096789 -19.250 < 2e-16 ***
statearizona 0.125178 0.126981 0.986 0.324415
statearkansas -0.116832 0.126518 -0.923 0.355950
statecalifornia -0.336849 0.127533 -2.641 0.008360 **
statecolorado -0.111448 0.128768 -0.865 0.386929
stateconnecticut -0.565718 0.127910 -4.423 1.06e-05 ***
stateflorida -0.183202 0.125293 -1.462 0.143936
stategeorgia -0.140358 0.126033 -1.114 0.265635
statehawaii -0.828533 0.133449 -6.209 7.21e-10 ***
stateidaho -0.391134 0.128707 -3.039 0.002422 **
stateillinois -0.019218 0.125636 -0.153 0.878452
stateindiana -0.093504 0.127058 -0.736 0.461917
stateiowa -0.315402 0.127153 -2.480 0.013248 *
statekansas 0.080232 0.126660 0.633 0.526559
statekentucky -0.107016 0.124302 -0.861 0.389435
statelouisiana -0.479374 0.125298 -3.826 0.000137 ***
statemaine -0.374422 0.127743 -2.931 0.003438 **
statemaryland -0.121152 0.126955 -0.954 0.340118
statemassachusetts -0.227338 0.126816 -1.793 0.073264 .
statemichigan -0.328098 0.127071 -2.582 0.009933 **
stateminnesota -0.333974 0.128276 -2.604 0.009333 **
statemississippi -0.273962 0.124497 -2.201 0.027946 *
statemissouri -0.214895 0.125187 -1.717 0.086297 .
statemontana -0.845197 0.127459 -6.631 4.90e-11 ***
statenebraska -0.309949 0.127931 -2.423 0.015540 *
statenew jersey -0.763339 0.127722 -5.977 2.95e-09 ***
statenew mexico 0.007216 0.132083 0.055 0.956441
statenew york -0.260273 0.126277 -2.061 0.039493 *
statenorth carolina -0.142962 0.125829 -1.136 0.256101
statenorth dakota -0.664777 0.127447 -5.216 2.13e-07 ***
stateohio -0.162257 0.125377 -1.294 0.195847
stateoklahoma -0.420574 0.126690 -3.320 0.000927 ***
stateoregon -0.623852 0.128276 -4.863 1.30e-06 ***
stateother states -0.191665 0.127963 -1.498 0.134427
statepennsylvania -0.175791 0.126727 -1.387 0.165632
statesouth carolina -0.190429 0.125468 -1.518 0.129324
statesouth dakota -0.608582 0.127808 -4.762 2.14e-06 ***
statetennessee 0.056411 0.124122 0.454 0.649561
statetexas -0.290287 0.125390 -2.315 0.020767 *
stateutah -0.191698 0.127974 -1.498 0.134393
statevermont -0.809742 0.127916 -6.330 3.38e-10 ***
statevirginia -0.108980 0.124633 -0.874 0.382061
statewashington -0.411207 0.128359 -3.204 0.001391 **
statewest virginia -0.179734 0.126531 -1.420 0.155713
statewisconsin -0.335018 0.127207 -2.634 0.008549 **
statewyoming -0.301592 0.128103 -2.354 0.018709 *
monthsQ2 -0.480356 0.036952 -13.000 < 2e-16 ***
monthsQ3 -0.252232 0.039059 -6.458 1.51e-10 ***
monthsQ4 -0.160444 0.037302 -4.301 1.83e-05 ***
Varroa.mites 0.664529 0.097210 6.836 1.26e-11 ***
Other.pests.parasites -0.333413 0.150519 -2.215 0.026930 *
Disesases 0.269497 0.235134 1.146 0.251951
Pesticides 0.038898 0.186651 0.208 0.834949
Other 1.956228 0.236612 8.268 3.39e-16 ***
Unknown 1.540075 0.293393 5.249 1.79e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.471 on 1279 degrees of freedom
Multiple R-squared: 0.4206, Adjusted R-squared: 0.3961
F-statistic: 17.19 on 54 and 1279 DF, p-value: < 2.2e-16
AIC(logit_mod)
[1] 1833.06
cat("Verify the hypothesis:\n")
Verify the hypothesis:
par(mfrow=c(2,2))
plot(logit_mod)
par(mfrow=c(1,1))
cat("Verify normality of residuals:\n")
Verify normality of residuals:
shapiro.test(residuals(logit_mod))
Shapiro-Wilk normality test
data: residuals(logit_mod)
W = 0.99192, p-value = 1.087e-06
shapiro.test(rstudent(logit_mod))
Shapiro-Wilk normality test
data: rstudent(logit_mod)
W = 0.99162, p-value = 6.91e-07
cat("VIF:\n")
VIF:
vif(logit_mod)
GVIF Df GVIF^(1/(2*Df))
state 3.833007 45 1.015041
months 1.223296 3 1.034162
Varroa.mites 2.070817 1 1.439033
Other.pests.parasites 2.466830 1 1.570615
Disesases 1.399190 1 1.182874
Pesticides 1.684843 1 1.298015
Other 1.381107 1 1.175205
Unknown 1.301936 1 1.141024
library(outliers)
x = outlierTest(logit_mod)
x
data_without_outliers = data[-c(897,921),]
logit_mod <- lm(data=data_without_outliers, logit_colony_lost_pct ~ state + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown)
summary(logit_mod)
Call:
lm(formula = logit_colony_lost_pct ~ state + months + Varroa.mites +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown, data = data_without_outliers)
Residuals:
Min 1Q Median 3Q Max
-1.49916 -0.27711 -0.00105 0.27992 1.48858
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.93736 0.09651 -20.075 < 2e-16 ***
statearizona 0.19470 0.12592 1.546 0.122309
statearkansas -0.04715 0.12546 -0.376 0.707100
statecalifornia -0.26709 0.12645 -2.112 0.034867 *
statecolorado -0.04120 0.12766 -0.323 0.746956
stateconnecticut -0.49594 0.12681 -3.911 9.69e-05 ***
stateflorida -0.11452 0.12428 -0.921 0.356997
stategeorgia -0.07181 0.12498 -0.575 0.565674
statehawaii -0.77134 0.13198 -5.844 6.45e-09 ***
stateidaho -0.32082 0.12759 -2.514 0.012046 *
stateillinois 0.04972 0.12461 0.399 0.689990
stateindiana -0.02313 0.12599 -0.184 0.854342
stateiowa -0.24572 0.12608 -1.949 0.051524 .
statekansas 0.14937 0.12561 1.189 0.234603
statekentucky -0.04021 0.12328 -0.326 0.744348
statelouisiana -0.41179 0.12422 -3.315 0.000942 ***
statemaine -0.30409 0.12666 -2.401 0.016498 *
statemaryland -0.05177 0.12589 -0.411 0.680979
statemassachusetts -0.15715 0.12575 -1.250 0.211646
statemichigan -0.25831 0.12600 -2.050 0.040554 *
stateminnesota -0.26209 0.12721 -2.060 0.039570 *
statemississippi -0.20658 0.12346 -1.673 0.094523 .
statemissouri -0.23694 0.12518 -1.893 0.058601 .
statemontana -0.77537 0.12638 -6.135 1.13e-09 ***
statenebraska -0.23915 0.12684 -1.885 0.059606 .
statenew jersey -0.69306 0.12663 -5.473 5.32e-08 ***
statenew mexico 0.07706 0.13085 0.589 0.556013
statenew york -0.19113 0.12523 -1.526 0.127193
statenorth carolina -0.07455 0.12478 -0.597 0.550317
statenorth dakota -0.59503 0.12636 -4.709 2.76e-06 ***
stateohio -0.09427 0.12434 -0.758 0.448504
stateoklahoma -0.35096 0.12563 -2.794 0.005289 **
stateoregon -0.55400 0.12716 -4.357 1.43e-05 ***
stateother states -0.12142 0.12687 -0.957 0.338727
statepennsylvania -0.10636 0.12566 -0.846 0.397481
statesouth carolina -0.12252 0.12440 -0.985 0.324849
statesouth dakota -0.53986 0.12671 -4.261 2.19e-05 ***
statetennessee 0.12237 0.12307 0.994 0.320264
statetexas -0.22139 0.12434 -1.780 0.075240 .
stateutah -0.12091 0.12689 -0.953 0.340838
statevermont -0.73923 0.12681 -5.829 7.04e-09 ***
statevirginia -0.04197 0.12359 -0.340 0.734230
statewashington -0.34118 0.12725 -2.681 0.007429 **
statewest virginia -0.11115 0.12546 -0.886 0.375806
statewisconsin -0.26449 0.12618 -2.096 0.036258 *
statewyoming -0.23105 0.12701 -1.819 0.069120 .
monthsQ2 -0.47955 0.03638 -13.183 < 2e-16 ***
monthsQ3 -0.24593 0.03841 -6.403 2.14e-10 ***
monthsQ4 -0.15358 0.03669 -4.186 3.03e-05 ***
Varroa.mites 0.66679 0.09554 6.979 4.77e-12 ***
Other.pests.parasites -0.30955 0.14799 -2.092 0.036657 *
Disesases 0.25958 0.23110 1.123 0.261561
Pesticides 0.01682 0.18348 0.092 0.926982
Other 1.96691 0.23257 8.457 < 2e-16 ***
Unknown 1.52945 0.28844 5.303 1.34e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.463 on 1277 degrees of freedom
Multiple R-squared: 0.4289, Adjusted R-squared: 0.4047
F-statistic: 17.76 on 54 and 1277 DF, p-value: < 2.2e-16
AIC(logit_mod)
[1] 1784.272
cat("Verify the hypothesis:\n")
Verify the hypothesis:
par(mfrow=c(2,2))
plot(logit_mod)
par(mfrow=c(1,1))
cat("Verify normality of residuals:\n")
Verify normality of residuals:
shapiro.test(residuals(logit_mod))
Shapiro-Wilk normality test
data: residuals(logit_mod)
W = 0.99589, p-value = 0.001175
shapiro.test(rstudent(logit_mod))
Shapiro-Wilk normality test
data: rstudent(logit_mod)
W = 0.99573, p-value = 0.0008545
cat("VIF:\n")
VIF:
vif(logit_mod)
GVIF Df GVIF^(1/(2*Df))
state 3.831742 45 1.015038
months 1.223416 3 1.034179
Varroa.mites 2.068878 1 1.438359
Other.pests.parasites 2.467406 1 1.570798
Disesases 1.399037 1 1.182809
Pesticides 1.685009 1 1.298079
Other 1.380845 1 1.175094
Unknown 1.301451 1 1.140811
# GLM NON DA USARE
logit_mod <- glm(colony_lost_pct ~ months + state + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown,
data = data,family = "binomial")
Warning: non-integer #successes in a binomial glm!
summary(logit_mod)
Call:
glm(formula = colony_lost_pct ~ months + state + Varroa.mites +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown, family = "binomial", data = data)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.51622 -0.12254 -0.02614 0.08359 1.23458
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.87893 0.58832 -3.194 0.0014 **
monthsQ2 -0.62693 0.26177 -2.395 0.0166 *
monthsQ3 -0.36568 0.26049 -1.404 0.1604
monthsQ4 -0.25561 0.24458 -1.045 0.2960
statearizona 0.10685 0.74269 0.144 0.8856
statearkansas -0.13023 0.76868 -0.169 0.8655
statecalifornia -0.44946 0.81323 -0.553 0.5805
statecolorado -0.10110 0.78789 -0.128 0.8979
stateconnecticut -0.71172 0.92716 -0.768 0.4427
stateflorida -0.26476 0.76885 -0.344 0.7306
stategeorgia -0.23230 0.76944 -0.302 0.7627
statehawaii -1.01425 1.05688 -0.960 0.3372
stateidaho -0.50608 0.84083 -0.602 0.5473
stateillinois -0.03364 0.76400 -0.044 0.9649
stateindiana -0.12667 0.78542 -0.161 0.8719
stateiowa -0.44666 0.82159 -0.544 0.5867
statekansas 0.05247 0.73055 0.072 0.9427
statekentucky -0.13283 0.75587 -0.176 0.8605
statelouisiana -0.61109 0.87970 -0.695 0.4873
statemaine -0.42119 0.85611 -0.492 0.6227
statemaryland -0.08836 0.79405 -0.111 0.9114
statemassachusetts -0.16292 0.80531 -0.202 0.8397
statemichigan -0.38803 0.82144 -0.472 0.6367
stateminnesota -0.38615 0.84246 -0.458 0.6467
statemississippi -0.37148 0.80912 -0.459 0.6462
statemissouri -0.23806 0.79868 -0.298 0.7657
statemontana -1.01201 0.96980 -1.044 0.2967
statenebraska -0.39720 0.86743 -0.458 0.6470
statenew jersey -0.99334 1.01737 -0.976 0.3289
statenew mexico 0.17811 0.78695 0.226 0.8209
statenew york -0.31611 0.80581 -0.392 0.6948
statenorth carolina -0.20728 0.77961 -0.266 0.7903
statenorth dakota -0.76106 0.92172 -0.826 0.4090
stateohio -0.14481 0.75984 -0.191 0.8489
stateoklahoma -0.38133 0.84739 -0.450 0.6527
stateoregon -0.79084 0.90686 -0.872 0.3832
stateother states -0.20610 0.82371 -0.250 0.8024
statepennsylvania -0.17917 0.79871 -0.224 0.8225
statesouth carolina -0.29410 0.80306 -0.366 0.7142
statesouth dakota -0.75117 0.89573 -0.839 0.4017
statetennessee 0.05660 0.73788 0.077 0.9389
statetexas -0.41221 0.83373 -0.494 0.6210
stateutah -0.28115 0.81209 -0.346 0.7292
statevermont -1.00318 1.02503 -0.979 0.3277
statevirginia -0.14226 0.77335 -0.184 0.8541
statewashington -0.50922 0.87180 -0.584 0.5592
statewest virginia -0.20013 0.80116 -0.250 0.8027
statewisconsin -0.39115 0.79841 -0.490 0.6242
statewyoming -0.36901 0.85976 -0.429 0.6678
Varroa.mites 0.73697 0.62098 1.187 0.2353
Other.pests.parasites -0.39809 0.98457 -0.404 0.6860
Disesases 0.14682 1.37740 0.107 0.9151
Pesticides 0.07104 1.17181 0.061 0.9517
Other 2.25375 1.43033 1.576 0.1151
Unknown 1.52043 1.74241 0.873 0.3829
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 67.769 on 1333 degrees of freedom
Residual deviance: 40.343 on 1279 degrees of freedom
AIC: 437.26
Number of Fisher Scoring iterations: 5
AIC(logit_mod)
[1] 437.2587
cat("Verify the hypothesis:\n")
Verify the hypothesis:
par(mfrow=c(2,2))
plot(logit_mod)
par(mfrow=c(1,1))
cat("Verify normality of residuals:\n")
Verify normality of residuals:
shapiro.test(residuals(logit_mod))
Shapiro-Wilk normality test
data: residuals(logit_mod)
W = 0.97137, p-value = 1.322e-15
shapiro.test(rstudent(logit_mod))
Shapiro-Wilk normality test
data: rstudent(logit_mod)
W = 0.97006, p-value = 5.355e-16
cat("VIF:\n")
VIF:
vif(logit_mod)
GVIF Df GVIF^(1/(2*Df))
months 1.268615 3 1.040451
state 3.524591 45 1.014096
Varroa.mites 1.950512 1 1.396607
Other.pests.parasites 2.144513 1 1.464416
Disesases 1.450458 1 1.204349
Pesticides 1.718088 1 1.310758
Other 1.443224 1 1.201343
Unknown 1.297506 1 1.139081
require(betareg)
beta_mod <- betareg(colony_lost_pct ~ months + Varroa.mites + Other.pests.parasites+Disesases+Pesticides+Other+Unknown + state,
data = data)
summary(beta_mod)
AIC(beta_mod)
library(lme4)
lm_mod <- lmer(colony_lost_pct ~ year + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown + (1|state),
data = data)
summary(lm_mod)
Linear mixed model fit by REML ['lmerMod']
Formula: colony_lost_pct ~ year + months + Varroa.mites + Other.pests.parasites +
Disesases + Pesticides + Other + Unknown + (1 | state)
Data: data
REML criterion at convergence: -3638.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.6402 -0.5915 -0.1267 0.4281 9.0569
Random effects:
Groups Name Variance Std.Dev.
state (Intercept) 0.0005931 0.02435
Residual 0.0034048 0.05835
Number of obs: 1334, groups: state, 46
Fixed effects:
Estimate Std. Error t value
(Intercept) 5.1556871 1.4868102 3.468
year -0.0025048 0.0007366 -3.401
monthsQ2 -0.0601780 0.0045730 -13.159
monthsQ3 -0.0403626 0.0048315 -8.354
monthsQ4 -0.0287235 0.0046271 -6.208
Varroa.mites 0.0816173 0.0119049 6.856
Other.pests.parasites -0.0504874 0.0176579 -2.859
Disesases 0.0175948 0.0287917 0.611
Pesticides 0.0037462 0.0227962 0.164
Other 0.2627312 0.0290583 9.042
Unknown 0.1925000 0.0358441 5.370
Correlation of Fixed Effects:
(Intr) year mnthQ2 mnthQ3 mnthQ4 Vrr.mt Othr.. Dissss Pstcds Other
year -1.000
monthsQ2 -0.010 0.008
monthsQ3 -0.072 0.071 0.500
monthsQ4 -0.080 0.079 0.484 0.511
Varroa.mits 0.058 -0.059 -0.117 -0.230 -0.170
Othr.psts.p 0.017 -0.017 -0.019 -0.061 -0.025 -0.386
Disesases -0.063 0.063 -0.005 0.043 -0.008 -0.097 -0.126
Pesticides -0.086 0.086 -0.082 -0.144 -0.083 -0.174 -0.154 -0.174
Other -0.047 0.047 -0.009 0.046 0.123 -0.144 -0.046 -0.151 -0.128
Unknown -0.045 0.044 0.127 0.095 0.020 -0.050 -0.055 -0.011 -0.057 -0.129
AIC(lm_mod)
[1] -3612.748
lm_mod <- lmer(colony_lost_pct ~ year + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown + (1|state),
data = data)
summary(lm_mod)
Linear mixed model fit by REML ['lmerMod']
Formula: colony_lost_pct ~ year + months + Varroa.mites + Other.pests.parasites +
Disesases + Pesticides + Other + Unknown + (1 | state)
Data: data
REML criterion at convergence: -3638.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.6402 -0.5915 -0.1267 0.4281 9.0569
Random effects:
Groups Name Variance Std.Dev.
state (Intercept) 0.0005931 0.02435
Residual 0.0034048 0.05835
Number of obs: 1334, groups: state, 46
Fixed effects:
Estimate Std. Error t value
(Intercept) 5.1556871 1.4868102 3.468
year -0.0025048 0.0007366 -3.401
monthsQ2 -0.0601780 0.0045730 -13.159
monthsQ3 -0.0403626 0.0048315 -8.354
monthsQ4 -0.0287235 0.0046271 -6.208
Varroa.mites 0.0816173 0.0119049 6.856
Other.pests.parasites -0.0504874 0.0176579 -2.859
Disesases 0.0175948 0.0287917 0.611
Pesticides 0.0037462 0.0227962 0.164
Other 0.2627312 0.0290583 9.042
Unknown 0.1925000 0.0358441 5.370
Correlation of Fixed Effects:
(Intr) year mnthQ2 mnthQ3 mnthQ4 Vrr.mt Othr.. Dissss Pstcds Other
year -1.000
monthsQ2 -0.010 0.008
monthsQ3 -0.072 0.071 0.500
monthsQ4 -0.080 0.079 0.484 0.511
Varroa.mits 0.058 -0.059 -0.117 -0.230 -0.170
Othr.psts.p 0.017 -0.017 -0.019 -0.061 -0.025 -0.386
Disesases -0.063 0.063 -0.005 0.043 -0.008 -0.097 -0.126
Pesticides -0.086 0.086 -0.082 -0.144 -0.083 -0.174 -0.154 -0.174
Other -0.047 0.047 -0.009 0.046 0.123 -0.144 -0.046 -0.151 -0.128
Unknown -0.045 0.044 0.127 0.095 0.020 -0.050 -0.055 -0.011 -0.057 -0.129
AIC(lm_mod)
[1] -3612.748
fm16.1mer = lm_mod
plot(fm16.1mer)
shapiro.test(residuals(fm16.1mer))
Shapiro-Wilk normality test
data: residuals(fm16.1mer)
W = 0.9154, p-value < 2.2e-16
library(lme4)
library(insight)
confint(fm16.1mer,oldNames=TRUE)
Computing profile confidence intervals ...
2.5 % 97.5 %
.sig01 0.01867574 0.03083460
.sigma 0.05621247 0.06072823
(Intercept) 0.08897113 0.10997659
monthsQ2 -0.06902405 -0.05107161
monthsQ3 -0.04866316 -0.02974364
monthsQ4 -0.03654416 -0.01843508
Varroa.mites 0.05598346 0.10266234
Other.pests.parasites -0.08610262 -0.01690467
Disesases -0.03265312 0.08011542
Pesticides -0.03410858 0.05500108
Other 0.21048896 0.32443905
Unknown 0.12782586 0.26913349
## Var-Cov matrix of fixed-effects
vcovb <- vcov(fm16.1mer)
cat("\nVar-Cov matrix of fixed-effects:\n")
Var-Cov matrix of fixed-effects:
vcovb
10 x 10 Matrix of class "dpoMatrix"
(Intercept) monthsQ2 monthsQ3 monthsQ4 Varroa.mites
(Intercept) 2.878523e-05 -8.383407e-06 -6.776304e-06 -7.886569e-06 -1.901355e-05
monthsQ2 -8.383407e-06 2.108707e-05 1.112091e-05 1.031227e-05 -6.413347e-06
monthsQ3 -6.776304e-06 1.112091e-05 2.341912e-05 1.138887e-05 -1.311044e-05
monthsQ4 -7.886569e-06 1.031227e-05 1.138887e-05 2.145541e-05 -9.192287e-06
Varroa.mites -1.901355e-05 -6.413347e-06 -1.311044e-05 -9.192287e-06 1.423791e-04
Other.pests.parasites 8.964961e-07 -1.523843e-06 -5.156934e-06 -1.972464e-06 -8.200498e-05
Disesases 3.652104e-06 -7.575724e-07 5.395792e-06 -1.793143e-06 -3.223109e-05
Pesticides 8.796375e-06 -8.649383e-06 -1.668943e-05 -9.601333e-06 -4.618682e-05
Other -2.327472e-05 -1.306918e-06 6.021490e-06 1.614666e-05 -4.923656e-05
Unknown -3.917203e-05 2.087241e-05 1.609280e-05 2.723386e-06 -2.059026e-05
Other.pests.parasites Disesases Pesticides Other
(Intercept) 8.964961e-07 3.652104e-06 8.796375e-06 -2.327472e-05
monthsQ2 -1.523843e-06 -7.575724e-07 -8.649383e-06 -1.306918e-06
monthsQ3 -5.156934e-06 5.395792e-06 -1.668943e-05 6.021490e-06
monthsQ4 -1.972464e-06 -1.793143e-06 -9.601333e-06 1.614666e-05
Varroa.mites -8.200498e-05 -3.223109e-05 -4.618682e-05 -4.923656e-05
Other.pests.parasites 3.138972e-04 -6.395886e-05 -6.182230e-05 -2.336295e-05
Disesases -6.395886e-05 8.323018e-04 -1.189189e-04 -1.302263e-04
Pesticides -6.182230e-05 -1.189189e-04 5.199147e-04 -8.791086e-05
Other -2.336295e-05 -1.302263e-04 -8.791086e-05 8.494389e-04
Unknown -3.462251e-05 -1.426727e-05 -5.012196e-05 -1.373550e-04
Unknown
(Intercept) -3.917203e-05
monthsQ2 2.087241e-05
monthsQ3 1.609280e-05
monthsQ4 2.723386e-06
Varroa.mites -2.059026e-05
Other.pests.parasites -3.462251e-05
Disesases -1.426727e-05
Pesticides -5.012196e-05
Other -1.373550e-04
Unknown 1.292646e-03
corb <- cov2cor(vcovb)
nms <- abbreviate(names(fixef(fm16.1mer)), 5)
rownames(corb) <- nms
cat("\nCorrelation matrix of fixed-effects:\n")
Correlation matrix of fixed-effects:
corb
10 x 10 Matrix of class "dpoMatrix"
(Intercept) monthsQ2 monthsQ3 monthsQ4 Varroa.mites
(Intercept) 1.000000000 -0.340273055 -0.26098937 -0.31734737 -0.29699917
monthsQ2 -0.340273055 1.000000000 0.50043425 0.48481701 -0.11704517
monthsQ3 -0.260989373 0.500434247 1.00000000 0.50807389 -0.22704349
monthsQ4 -0.317347372 0.484817007 0.50807389 1.00000000 -0.16631526
Varroa.mites -0.296999172 -0.117045171 -0.22704349 -0.16631526 1.00000000
Other.pests.parasites 0.009431263 -0.018730025 -0.06014681 -0.02403515 -0.38790325
Disesases 0.023594889 -0.005718413 0.03864822 -0.01341857 -0.09362924
Pesticides 0.071903970 -0.082605876 -0.15124818 -0.09090695 -0.16975749
Other -0.148844779 -0.009765045 0.04269260 0.11960471 -0.14157890
Unknown -0.203072614 0.126422543 0.09249247 0.01635313 -0.04799532
Other.pests.parasites Disesases Pesticides Other Unknown
(Intercept) 0.009431263 0.023594889 0.07190397 -0.148844779 -0.20307261
monthsQ2 -0.018730025 -0.005718413 -0.08260588 -0.009765045 0.12642254
monthsQ3 -0.060146806 0.038648223 -0.15124818 0.042692602 0.09249247
monthsQ4 -0.024035152 -0.013418566 -0.09090695 0.119604710 0.01635313
Varroa.mites -0.387903252 -0.093629240 -0.16975749 -0.141578903 -0.04799532
Other.pests.parasites 1.000000000 -0.125131469 -0.15303309 -0.045244719 -0.05435317
Disesases -0.125131469 1.000000000 -0.18077747 -0.154878868 -0.01375500
Pesticides -0.153033095 -0.180777468 1.00000000 -0.132284935 -0.06113953
Other -0.045244719 -0.154878868 -0.13228493 1.000000000 -0.13108059
Unknown -0.054353173 -0.013755004 -0.06113953 -0.131080587 1.00000000
cat("Var-Cov matrix of random-effects and errors\n")
Var-Cov matrix of random-effects and errors
print(vc <- VarCorr(fm16.1mer), comp = c("Variance", "Std.Dev."))
Groups Name Variance Std.Dev.
state (Intercept) 0.00058802 0.024249
Residual 0.00343356 0.058597
sigma2_eps <- as.numeric(get_variance_residual(fm16.1mer))
cat("the variance associated to eps sigma2_eps is",sigma2_eps)
the variance associated to eps sigma2_eps is 0.003433556
sigma2_b <- as.numeric(get_variance_random(fm16.1mer))
cat("the variance associated to random effect sigma2_b is",sigma2_b)
the variance associated to random effect sigma2_b is 0.0005880246
## Let's compute the conditional and marginal var-cov matrix of Y
sgma <- summary(fm16.1mer)$sigma # sigma^2
A <- getME(fm16.1mer, "A") # A --> N x n, A represents the D (not italic), variance of random effect
I.n <- Diagonal(ncol(A)) # IN --> n x n
## the conditional variance-covariance matrix of Y (diagonal matrix)
## conditional to the random effect è semplicemente la matrice fixed effect
cat("\n SigmaErr:\n")
SigmaErr:
SigmaErr = sgma^2 * (I.n)
# SigmaErr ha dimensione n_oss x n_oss
# Conditioned to the random effects b_i, we observe the var-cov of the errors
# that are independent and homoscedastic
## we visualize the first 20 rows/columns of the matrix
plot(as.matrix(SigmaErr[1:20,1:20]), main = 'Conditional estimated Var-Cov matrix of Y')
cat("the MARGINAL variance-covariance matrix of Y (block-diagonal matrix) is")
the MARGINAL variance-covariance matrix of Y (block-diagonal matrix) is
V <- sgma^2 * (I.n + crossprod(A)) # V = s^2*(I_N+A*A) --> s^2*(I_N) is the error part, s^2*(A*A) is the random effect part
#-> V is a block-diagional matrix, the marginal var-cov matrix
# visualization of the first 20 rows/columns
plot(as.matrix(V[1:20,1:20]), main = 'Marginal estimated Var-Cov matrix of Y')
# Another way to interpret the variance output is to note percentage of the subject variance out
# of the total, i.e. the Percentage of Variance explained by the Random Effect (PVRE).
# This is also called the intraclass correlation (ICC), because it is also an estimate of the within
# cluster correlation.
PVRE <- sigma2_b/(sigma2_b+sigma2_eps)
cat("The Proportion of Variance due to Random Effect is",PVRE) # 15% is quite high!
The Proportion of Variance due to Random Effect is 0.1462173
cat("\nvisualization of the random intercepts with their 95% confidence intervals in the dotplot\n")
visualization of the random intercepts with their 95% confidence intervals in the dotplot
# Random effects: b_0i for i=1,...,234
dotplot(ranef(fm16.1mer, condVar=T))
$state
library(plotly)
x = ranef(fm16.1mer, condVar=T)
us_data <- map_data("state")
df <- data.frame(
state = tolower(rownames(x$state)),
values = x$state$`(Intercept)`
)
library(usmap)
plot_usmap(data = df) + labs(title = "Cluster by prec")
# 1) Assessing Assumption on the within-group errors
#it's just a sample from the entire population, so to take with care
plot(fm16.1mer) ## Pearson and raw residuals are the same now
qqnorm(resid(fm16.1mer))
qqline(resid(fm16.1mer), col='red', lwd=2)
shapiro.test(resid(fm16.1mer))
Shapiro-Wilk normality test
data: resid(fm16.1mer)
W = 0.9154, p-value < 2.2e-16
# 2) Assessing Assumption on the Random Effects
qqnorm(unlist(ranef(fm16.1mer)$state), main='Normal Q-Q Plot - Random Effects on Intercept')
qqline(unlist(ranef(fm16.1mer)$state), col='red', lwd=2)
shapiro.test(unlist(ranef(fm16.1mer)$state))
Shapiro-Wilk normality test
data: unlist(ranef(fm16.1mer)$state)
W = 0.98279, p-value = 0.7216
AIC(fm16.1mer)
[1] -3615.818
lm_mod_log <- lmer(logit_colony_lost_pct ~ year + months + Varroa.mites +Other.pests.parasites+Disesases+Pesticides+Other+Unknown + (1|state),
data = data)
summary(lm_mod_log)
Linear mixed model fit by REML ['lmerMod']
Formula:
logit_colony_lost_pct ~ year + months + Varroa.mites + Other.pests.parasites +
Disesases + Pesticides + Other + Unknown + (1 | state)
Data: data
REML criterion at convergence: 1880.8
Scaled residuals:
Min 1Q Median 3Q Max
-3.1235 -0.5770 -0.0122 0.5902 5.5002
Random effects:
Groups Name Variance Std.Dev.
state (Intercept) 0.05026 0.2242
Residual 0.21903 0.4680
Number of obs: 1334, groups: state, 46
Fixed effects:
Estimate Std. Error t value
(Intercept) 47.653452 11.926652 3.996
year -0.024679 0.005908 -4.177
monthsQ2 -0.481306 0.036686 -13.120
monthsQ3 -0.265882 0.038783 -6.856
monthsQ4 -0.173906 0.037125 -4.684
Varroa.mites 0.703712 0.095744 7.350
Other.pests.parasites -0.345946 0.143167 -2.416
Disesases 0.180222 0.231564 0.778
Pesticides 0.001939 0.183514 0.011
Other 1.956701 0.233538 8.379
Unknown 1.647476 0.288376 5.713
Correlation of Fixed Effects:
(Intr) year mnthQ2 mnthQ3 mnthQ4 Vrr.mt Othr.. Dissss Pstcds Other
year -1.000
monthsQ2 -0.010 0.008
monthsQ3 -0.072 0.071 0.500
monthsQ4 -0.080 0.079 0.484 0.511
Varroa.mits 0.058 -0.059 -0.118 -0.232 -0.171
Othr.psts.p 0.018 -0.018 -0.020 -0.063 -0.027 -0.382
Disesases -0.064 0.064 -0.005 0.043 -0.008 -0.095 -0.132
Pesticides -0.087 0.087 -0.081 -0.144 -0.083 -0.173 -0.159 -0.172
Other -0.048 0.047 -0.009 0.047 0.123 -0.144 -0.048 -0.151 -0.126
Unknown -0.045 0.044 0.127 0.095 0.020 -0.051 -0.054 -0.013 -0.054 -0.127
AIC(lm_mod_log)
[1] 1906.818
plot(lm_mod_log)
shapiro.test(residuals(lm_mod_log))
Shapiro-Wilk normality test
data: residuals(lm_mod_log)
W = 0.99062, p-value = 1.592e-07
library(mgcv)
mod_gam = gam(colony_lost_pct ~ year + months + s(Varroa.mites,bs='tp') +Other.pests.parasites+Disesases+Pesticides+Other+Unknown + state, data = data)
summary(mod_gam)
Family: gaussian
Link function: identity
Formula:
colony_lost_pct ~ year + months + s(Varroa.mites, bs = "tp") +
Other.pests.parasites + Disesases + Pesticides + Other +
Unknown + state
Parametric coefficients:
Estimate Std. Error t value
(Intercept) 5.5260467 1.4847134 3.722
year -0.0026593 0.0007354 -3.616
monthsQ2 -0.0613768 0.0045969 -13.352
monthsQ3 -0.0415819 0.0048986 -8.489
monthsQ4 -0.0302073 0.0046885 -6.443
Other.pests.parasites -0.0459144 0.0187584 -2.448
Disesases 0.0175029 0.0291659 0.600
Pesticides 0.0061584 0.0231664 0.266
Other 0.2535213 0.0293613 8.635
Unknown 0.1758598 0.0362995 4.845
statearizona 0.0169103 0.0156753 1.079
statearkansas -0.0143230 0.0156305 -0.916
statecalifornia -0.0511942 0.0158766 -3.224
statecolorado -0.0110859 0.0159158 -0.697
stateconnecticut -0.0617037 0.0158093 -3.903
stateflorida -0.0320959 0.0156045 -2.057
stategeorgia -0.0254979 0.0156614 -1.628
statehawaii -0.0719185 0.0165875 -4.336
stateidaho -0.0548765 0.0159085 -3.450
stateillinois -0.0058733 0.0155178 -0.378
stateindiana -0.0143542 0.0156826 -0.915
stateiowa -0.0461383 0.0157033 -2.938
statekansas 0.0208066 0.0156416 1.330
statekentucky -0.0161372 0.0153743 -1.050
statelouisiana -0.0572221 0.0154701 -3.699
statemaine -0.0382717 0.0158274 -2.418
statemaryland -0.0085159 0.0156844 -0.543
statemassachusetts -0.0172211 0.0156639 -1.099
statemichigan -0.0397056 0.0157084 -2.528
stateminnesota -0.0384881 0.0158745 -2.425
statemississippi -0.0395693 0.0153712 -2.574
statemissouri -0.0236265 0.0154902 -1.525
statemontana -0.0835353 0.0157492 -5.304
statenebraska -0.0372543 0.0158226 -2.354
statenew jersey -0.0743590 0.0157899 -4.709
statenew mexico 0.0348459 0.0163957 2.125
statenew york -0.0368258 0.0155991 -2.361
statenorth carolina -0.0244718 0.0155362 -1.575
statenorth dakota -0.0673175 0.0157752 -4.267
stateohio -0.0170303 0.0154988 -1.099
stateoklahoma -0.0346881 0.0157300 -2.205
stateoregon -0.0772707 0.0158699 -4.869
stateother states -0.0201813 0.0158388 -1.274
statepennsylvania -0.0224632 0.0156617 -1.434
statesouth carolina -0.0337539 0.0154904 -2.179
statesouth dakota -0.0663129 0.0158477 -4.184
statetennessee 0.0071402 0.0153367 0.466
statetexas -0.0469480 0.0155199 -3.025
stateutah -0.0312697 0.0158357 -1.975
statevermont -0.0725679 0.0158225 -4.586
statevirginia -0.0200102 0.0154137 -1.298
statewashington -0.0512636 0.0158557 -3.233
statewest virginia -0.0236389 0.0156273 -1.513
statewisconsin -0.0439683 0.0157134 -2.798
statewyoming -0.0331200 0.0159010 -2.083
Pr(>|t|)
(Intercept) 0.000206 ***
year 0.000311 ***
monthsQ2 < 2e-16 ***
monthsQ3 < 2e-16 ***
monthsQ4 1.66e-10 ***
Other.pests.parasites 0.014512 *
Disesases 0.548536
Pesticides 0.790410
Other < 2e-16 ***
Unknown 1.42e-06 ***
statearizona 0.280885
statearkansas 0.359656
statecalifornia 0.001294 **
statecolorado 0.486221
stateconnecticut 1.00e-04 ***
stateflorida 0.039906 *
stategeorgia 0.103756
statehawaii 1.57e-05 ***
stateidaho 0.000580 ***
stateillinois 0.705131
stateindiana 0.360211
stateiowa 0.003361 **
statekansas 0.183688
statekentucky 0.294091
statelouisiana 0.000226 ***
statemaine 0.015743 *
statemaryland 0.587259
statemassachusetts 0.271797
statemichigan 0.011603 *
stateminnesota 0.015467 *
statemississippi 0.010158 *
statemissouri 0.127444
statemontana 1.33e-07 ***
statenebraska 0.018699 *
statenew jersey 2.76e-06 ***
statenew mexico 0.033753 *
statenew york 0.018387 *
statenorth carolina 0.115470
statenorth dakota 2.12e-05 ***
stateohio 0.272056
stateoklahoma 0.027617 *
stateoregon 1.26e-06 ***
stateother states 0.202836
statepennsylvania 0.151739
statesouth carolina 0.029513 *
statesouth dakota 3.06e-05 ***
statetennessee 0.641609
statetexas 0.002536 **
stateutah 0.048525 *
statevermont 4.95e-06 ***
statevirginia 0.194450
statewashington 0.001256 **
statewest virginia 0.130612
statewisconsin 0.005217 **
statewyoming 0.037460 *
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Varroa.mites) 4.191 5.204 10.34 <2e-16 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = 0.37 Deviance explained = 39.8%
GCV = 0.0035351 Scale est. = 0.0033783 n = 1334
gam::plot.Gam(mod_gam, se=TRUE)